//
//  MHSearchBar.m
// MiaoCircle
//
//Created by acgera on 2018/4/9.
//  Copyright © 2018年 acgera. All rights reserved.
//

#import "MHSearchBar.h"

@implementation MHSearchBar
+ (void)initialize{
    [super initialize];
    
    
}
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self initialize];
    }
    return self;
}

- (instancetype)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        [self initialize];
    }
    return self;
}

- (void)initialize {
    self.placeholder = @"搜索";
    self.barStyle = UIBarStyleDefault;
    //搜索的背景色
    self.barTintColor = MH_MAIN_BACKGROUNDCOLOR; //MH_MAIN_BACKGROUNDCOLOR;
    self.tintColor = [UIColor whiteColor];
    [self setBackgroundImage:[UIImage new]];
//    [self setSearchFieldBackgroundImage:[UIImage new] forState:UIControlStateNormal];
//    UIImageView *view = [[[self.subviews objectAtIndex:0] subviews] firstObject];
//    view.layer.borderColor = MHColorFromHexString(@"#DFDFDD").CGColor;
//    view.layer.borderWidth = 1;
//    self.backgroundImage = MHImageNamed(@"widget_searchbar_cell_bg_5x44");
//    [self setSearchFieldBackgroundImage:MHImageNamed(@"widget_searchbar_textfield_17x28") forState:UIControlStateNormal];
    self.searchBarStyle = UISearchBarStyleProminent;
    [self sizeToFit];
}

@end
